package edu.gdut.tiantian.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import edu.gdut.tiantian.utils.DateUtils;

public class User {
	private String id;
	private String username;
	private String password;
	private String mobile;
	private String email;
	private Integer status;
	private String statusStr;
	private Integer sex;
	private String sexStr;
	private Date birthday;
	private String birthdayStr;
	private List<CartItem> cartItems;
	private List<Order> orders = new ArrayList<Order>();  
	
	public List<CartItem> getCartItems() {
		return cartItems;
	}
	public void setCartItems(List<CartItem> cartItems) {
		this.cartItems = cartItems;
	}
	public List<Order> getOrders() {
		return orders;
	}
	public void setOrders(List<Order> orders) {
		this.orders = orders; 
	}
	public String getBirthdayStr() {
		birthdayStr = DateUtils.DateToString(birthday, "YYYY-MM-dd");
		return birthdayStr;
	}
	public void setBirthdayStr(String birthdayStr) {
		this.birthdayStr = birthdayStr;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public String getSexStr() {
		if(sex == 1) {
			sexStr = "男";
		}else {
			sexStr = "女";
		}
		return sexStr;
	}
	public void setSexStr(String sexStr) {
		this.sexStr = sexStr;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public String getStatusStr() {
		if(status == 1) {
			statusStr = "解封";
		}else {
			statusStr = "已冻结";
		}
		return statusStr;
	}
	public void setStatusStr(String statusStr) {
		this.statusStr = statusStr;
	}
	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", password=" + password + ", mobile=" + mobile
				+ ", email=" + email + ", status=" + status + ", statusStr=" + statusStr + ", sex=" + sex + ", sexStr="
				+ sexStr + ", birthday=" + birthday + ", birthdayStr=" + birthdayStr + ", cartItems=" + cartItems
				+ ", orders=" + orders + "]";
	}
	
}
